package cn.szzsi.platform.interceptor;

import cn.szzsi.model.Member;
import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;
import com.jfinal.core.Controller;
import com.jfinal.kit.StrKit;

/**
 * Created by admin on 2017/5/22.
 */
public class SysAdminInterceptor implements Interceptor {
    public void intercept(Invocation ai) {
        Controller c = ai.getController();
        c.setAttr("base", c.getRequest().getContextPath());
        String loginMemberId = c.getSessionAttr("sysSessionId");//获取当前登录用户
        if(StrKit.isBlank(loginMemberId)){
            //c.redirect("/sys/login");//个人中心
            c.renderHtml("<script>top.location.href='/sys/login';</script>");
            return;
        }

        ai.invoke();
    }

}
